//
//  YSOrderReviewFrame.m
//  Yueshi
//
//  Created by Northwan on 15/9/30.
//  Copyright © 2015年 悦食中国. All rights reserved.
//  计算评价商品的cell frame

#import "YSOrderReviewFrame.h"
#import "YSPhotosView.h"


@implementation YSOrderReviewFrame

-(void)setProduct:(YSCartProduct *)product{
    _product = product;
    
    _iconFrame = CGRectMake(YSPublicXInset, YSPublicXInset, 60, 60);
    
    _nameFrame = CGRectMake(CGRectGetMaxX(_iconFrame)+YSPublicXInset, YSPublicXInset, SCREENW-YSPublicXInset*3, NAMEFONT);
    
    _skuFrame  = CGRectMake(CGRectGetMinX(_nameFrame), CGRectGetMaxY(_nameFrame)+YSPublicXInset, SCREENW-YSPublicXInset*3, SKUFONT);
    
    _scoreX = CGRectGetMaxX(_iconFrame);
    UIImage *img =  [UIImage imageNamed:@"btn_star_gray"];
    _scoreY = CGRectGetMaxY(_iconFrame)-img.size.height;
    
    _selectFrame = CGRectMake(SCREENW-37-YSPublicXInset, CGRectGetMaxY(_iconFrame)+YSPublicXInset, 37, 40);
    
    _reviewFrame = CGRectMake(YSPublicXInset, CGRectGetMaxY(_iconFrame)+YSPublicXInset, SCREENW-YSPublicXInset*3-37, 40);
    
    ;

    _spliteFrame = CGRectMake(0,CGRectGetMaxY(_reviewFrame)+YSPublicXInset, SCREENW, YSPublicXInset);
    
    if(product.photosImage.count){
        _photosX = 0;
        _photosY = CGRectGetMaxY(_reviewFrame)+YSPublicXInset;
        _spliteFrame = CGRectMake(0, CGRectGetMaxY(_reviewFrame)+YSPublicXInset*2+photoW, SCREENW, YSPublicXInset);
    }
    
    _cellHeight = CGRectGetMaxY(_spliteFrame);
    _frame = CGRectMake(0, 0, SCREENW, _cellHeight);
}

@end
